<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="https://unpkg.com/vue@next"></script>

    <div id="app">
        <input type="range" min="0" max="500" v-model="val">
        <p v-pin:[direction]="val">val:{{val}}</p>
    </div>

    <script>
        const vueOpt = {
            data(){
                return {
                    val: 0,
                    direction: 'left'
                }
            }
        }

        const app = Vue.createApp(vueOpt);

        app.directive('pin',{
            mounted(el, binding){
                console.log('binding:', binding);
                el.style.position = 'fixed';
                const direction = binding.arg || 'top'
                el.style[direction] = binding.value + 'px'
            },

            updated(el, binding){
                console.log('binding.value:', binding.value);
                const direction =binding.arg || 'top';
                el.style[direction] = binding.value + 'px';
            }
        });
        app.mount('#app');
    </script>
</body>
</html>